#include "TimeDistortionProcess.h"
#include "GameApp.h"

TimeDistortionProcess::TimeDistortionProcess(const float speed, const float aim)
{
	mfSpeed = speed;
	mfAim = aim;
}

TimeDistortionProcess::~TimeDistortionProcess(void)
{

}

void TimeDistortionProcess::update(const unsigned long elapsedTime)
{
	float factor = gpApp->getTimeFactor();

	if (factor < mfAim)
	{
		factor *= mfSpeed;
		if (factor > mfAim)
		{
			gpApp->setTimeFactor(mfAim);
			kill();
			return;
		}
	}
	else
	{
		factor *= mfSpeed;
		if (factor < mfAim)
		{
			gpApp->setTimeFactor(mfAim);
			kill();
			return;
		}
	}
	
	gpApp->setTimeFactor(factor);
}
